﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<Uitlening>>" %>
<%@ Import namespace="ICT4Events.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Materiaalverhuur
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<link type="text/css" href="../../Content/jquery-ui-1.8.11.custom.css" rel="Stylesheet" />

    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("#BeginDatum").datepicker({
                dateFormat: 'dd/M/yy',
                changeMonth: true,
                changeYear: true
            });
            $("#BeginDatum").datepicker("option", "showAnim", 'show');

            $("#EindDatum").datepicker({
                dateFormat: 'dd/M/yy',
                changeMonth: true,
                changeYear: true
            });
            $("#EindDatum").datepicker("option", "showAnim", 'show');


            $("#Materiaal").change(function () {
                var Type = $("#Materiaal").val();
                $.ajax({
                    type: "GET",
                    data: "type=" + Type,
                    url: '<%:Url.Action("GetInformatie", "Home")%>',
                    dataType: "html",
                    success: function (result) {
                        $('#Informatie').html(result);
                    }
                });

            });
            $("#Materiaal").change();


            $("#verhuren").click(function () {
                //var Type = $("#Materiaal").val();
                $.ajax({
                    type: "GET",
                    data: "type=" + Type,
                    url: '<%:Url.Action("GetInformatie", "Home")%>',
                    dataType: "html",
                    success: function (result) {
                        $('#Informatie').html(result);
                    }
                });

            });
        });
    </script>
    <h2>Materiaalverhuur</h2>
    <%= Html.ValidationSummary("Verbeter de gegevens en probeer opnieuw.")%>
    <div style="float:left">
        <h3>Gereserveerde items</h3>

        <%if (Model.Count() > 0)
          { %>
        <table>
            <tr>
                <th>Type</th>
                <th>Aantal</th>
                <th>Van</th>
                <th>Tot</th>
            </tr>
            <%foreach (Uitlening u in Model)
              { %>
              <tr>
                <td><%:u.Type%></td>
                <td><%:u.Aantal.ToString()%></td>
                <td><%:u.Datum_uitgeleend.ToShortDateString()%></td>
                <td><%:u.Datum_ingeleverd.ToShortDateString()%></td>
              </tr>
              <%} %>
        </table>
        <%}
          else
          {%>
          Er is nog geen materiaal verhuurd.
        <%} %>
    </div>


    <div style="float:left; padding-left:50px; padding-top:45px">
    <% using (Html.BeginForm())
       {%>
        
    <table style="border: 0px">
        <tr >
            <td style="border: 0px">Begindatum</td>
            <td style="border: 0px"><input id="BeginDatum" name="BeginDatum" type="text" readonly="readonly"/></td>
        </tr>
        <tr style="border: 0px">
            <td style="border: 0px">Einddatum</td>
            <td style="border: 0px"><input id="EindDatum" name="EindDatum" type="text" readonly="readonly"/></td>
        </tr>
        <tr style="border: 0px">
            <td style="border: 0px">Materiaal</td>
            <td style="border: 0px; text-align:right"><%:Html.DropDownList("Materiaal") %></td>
        </tr>
    </table>

<div id="Informatie"></div>
    <table style="border: 0px">
        <tr >
            <td style="border: 0px"><input id="verhuren" type="submit" value="Verhuren"/></td>
        </tr>
    </table>

    <%} %>

    </div>

    <div style="clear:both"></div>
</asp:Content>
